package Entity;

import java.sql.ResultSet;

import Control.MySQLController;

public class Workshop_WorkshopStatusCode {
	//Attributes
	String statusCode;
	String description;

	//Getters and Setters
	public String getStatusCode() {
		return statusCode;
	}
	public void setStatusCode(String statusCode) {
		this.statusCode = statusCode;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	
	//Constructors
	public Workshop_WorkshopStatusCode(){};
	
	public Workshop_WorkshopStatusCode(String statusCode){
		this.statusCode = statusCode;
	}
	
	public Workshop_WorkshopStatusCode(String statusCode, String description){
		this.statusCode = statusCode;
		this.description = description;		
	}
	
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	public boolean retrieveWorkshopStatus(){
		boolean success = false;
		ResultSet rs = null;
		MySQLController db = new MySQLController();
		db.getConnection();
		String sql = "SELECT * FROM ooadpj.workshop_status WHERE workshop_status_code = '" + statusCode + "'";
		rs = db.readRequest(sql);
		try{
			while(rs.next()){
				description = rs.getString("description");
			}
		}
		catch(Exception e){
			e.printStackTrace();
		}
		finally{
			db.terminate();
		}
		return success;
	}
}
